package com.ouc.pampas;

import java.io.Serializable;

public class Service implements Serializable {
	private static final long serialVersionUID = 6022055077761299899L;
	private String app;
	private ServiceType type;
	private String uri;
	private String desc;

	public String toString() {
		return "Service(app=" + getApp() + ", type=" + getType() + ", uri=" + getUri() + ", desc=" + getDesc() + ")";
	}

	public String getApp() {
		return this.app;
	}

	public void setApp(String app) {
		this.app = app;
	}

	public ServiceType getType() {
		return this.type;
	}

	public Service() {
		this.type = ServiceType.DUBBO;
	}

	public void setType(ServiceType type) {
		this.type = type;
	}

	public String getUri() {
		return this.uri;
	}

	public void setUri(String uri) {
		this.uri = uri;
	}

	public String getDesc() {
		return this.desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public static enum ServiceType {
		HTTP, DUBBO, SPRING;

		private ServiceType() {
		}
	}

	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof Service)) {
			return false;
		}
		Service service = (Service) o;
		if (!this.app.equals(service.app)) {
			return false;
		}
		if (this.type != service.type) {
			return false;
		}
		if (!this.uri.equals(service.uri)) {
			return false;
		}
		return true;
	}

	public int hashCode() {
		int result = this.app.hashCode();
		result = 31 * result + this.type.hashCode();
		result = 31 * result + this.uri.hashCode();
		return result;
	}
}
